#********************************************************************+
# Copyright 2018 Daniel 'grindhold' Brendle
#
# This file is part of phexfile.
#
# phexfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later
# version.
#
# phexfile is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with phexfile.
# If not, see http://www.gnu.org/licenses/.
#*********************************************************************

phexfile_lib_source = [
    'simulation.vala'
]

valagir = 'Phexfile-' + api + '.gir'

phexfile_lib = shared_library('phexfile-'+api, phexfile_lib_source,
                               dependencies: [glib, json_glib],
                               vala_gir: valagir,
                               vala_header: 'phexfile.h',
                               install:true,
                               version: phexfile_version)

g_ir_compiler = find_program('g-ir-compiler')
custom_target('phexfile-typelib',
              command: [g_ir_compiler, '--output', '@OUTPUT@', 'src/'+valagir, '--shared-library', 'libphexfile-' + api + '.so'],
              output: 'Phexfile-'+api+'.typelib',
              depends: phexfile_lib,
              install: true,
              install_dir: get_option('libdir')+'/girepository-1.0')


phexfile_h = meson.current_build_dir()+'/phexfile.h'
run_command ('touch', phexfile_h)
install_headers(phexfile_h, subdir: 'phexfile-'+api)

phexfile_vapi = meson.current_build_dir()+'/phexfile-'+api+'.vapi'
run_command ('touch', phexfile_vapi)
install_data(phexfile_vapi, install_dir: get_option('datadir') + '/vala/vapi')


